import addAnime from "../plugins/Anime.js";

export function initIcon(name, config) {
    let sprite = new PIXI.AnimatedSprite(Resources[name]);

    Object.assign(sprite, {
        animationSpeed: 0.2,
        interactive: true,
        height: 80 * px,
        width: 80 * px,
        anchor: { x: 0.5, y: 0.5 },
    });
    Object.entries(config).forEach(([key, value]) => {
        sprite[key] = value;
    });
    addAnime(sprite);
    // sprite.play();
    sprite.loop = true;
    window.app.stage.addChild(sprite);
    return sprite;
}
